package com.audaque.springboot.foshanupload.web.httpclientdemo.ieg.token;

import cn.hutool.core.net.url.UrlBuilder;
import com.audaque.springboot.foshanupload.web.httpclientdemo.ieg.IegProperties;
import com.audaque.springboot.foshanupload.web.httpclientdemo.ieg.model.HutoolRequest;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * @author zgb
 * @desc ...
 * @date 2022-04-17 19:01:59
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Component
@ConfigurationProperties(prefix = "ieg.token")
public class IegTokenProperties extends IegProperties {
    private String host;
    private String userName;
    private String userAuthKey;
    private HutoolRequest tokens;
    private HutoolRequest authorize;

    public String getTokensUrl() {
        return UrlBuilder.create().setScheme(super.getScheme()).setHost(host).addPath(tokens.getPath()).build();
    }

    public String getAuthorizeUrl() {
        return UrlBuilder.create().setScheme(super.getScheme()).setHost(host).addPath(authorize.getPath()).build();
    }

}
